import request from '@/config/axios'

export interface DeviceVO {
  id: number
  sn: string
  imei: string
  remark: string
  name: string
  type: number
  status: byte
  mac: string
}

// 查询设备分页
export const getDevicePage = async (data) => {
  return await request.post({ url: `/system/device/page`, data })
}
export const getTenantDevicePage = async (data) => {
  return await request.post({ url: `/system/device/tenant-page`, data })
}
// 查询设备列表
export const getDeviceList = async (data) => {
  return await request.post({ url: `/system/device/query`, data })
}

// 查询设备详情
export const getDevice = async (id: number) => {
  return await request.get({ url: `/system/device/get?id=` + id })
}

// 新增设备
export const createDevice = async (data: DeviceVO) => {
  return await request.post({ url: `/system/device/create`, data })
}

// 修改设备
export const updateDevice = async (data: DeviceVO) => {
  return await request.put({ url: `/system/device/update`, data })
}

// 删除设备
export const deleteDevice = async (id: number) => {
  return await request.delete({ url: `/system/device/delete?id=` + id })
}

// 导出设备 Excel
export const exportDevice = async (params) => {
  return await request.download({ url: `/system/device/export-excel`, params })
}

// 下载设备 Excel模版
export const importTemplate = async () => {
  return await request.download({ url: `/system/device/get-import-template` })
}

// 批量导入设备
export const importDevice = async (data) => {
  return await request.post({ url: `/system/device/import`, data })
}
